<%@ page language="java" contentType="text/html; charset=UTF-8" 
import="com.google.appengine.api.datastore.KeyFactory,java.util.*,org.windblog.core.entity.*,org.windblog.core.*"  pageEncoding="UTF-8"%>
<%

	List<Link> links = null ;  //要列出的link
	links = LinkService.getLinks();
	
	String mnp     = request.getParameter("message");
	int messageNum = 0;
	if(mnp!=null)
		messageNum = Integer.parseInt(mnp);
	String message = null;
	switch(messageNum){
		case 1  : message = "添加链接成功.";break;
		case 2  : message = "添加链接失败.";break;
		case 3  : message = "删除链接失败.";break;
		case 4  : message = "删除链接成功.";break;
		case 5  : message = "修改链接成功.";break;
		case 6  : message = "修改链接失败.";break;
		default : message = null;
	}
%>
		<jsp:include page="header.jsp"></jsp:include>
		<jsp:include page="sidebar.jsp"></jsp:include>
		<script type="text/javascript">
			$(function(){
				// Accordion
				$("#accordion").accordion("activate",2);
				$("#link_manager").prepend(">");
			});
		</script>
		<div id="content">
			<h2>Edit Links</h2>
			<hr/>
			<% if(message!=null){%>
			<div class="ui-widget" style="width:50em">
			<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> 
				<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
				<%=message%>
				</p>
			</div>
			</div><br/>
			<%} 
			%>
			<div id="postspanel" class="ui-widget ui-widget-content ui-corner-all" style="margin-top:10px;padding:0;width:800px"> 
			<h3 class="ui-widget-header" style="padding:5px 10px;font-size:12px;">Posts</h3>
				<table id="posts" border="1" cellspacing="0" style="width:100%">
					<thead>
					<tr>
						<th>Name</th>
						<th>URL</th>
						<th>Visible</th>
					</tr>
					</thead>
					<%
						
						if(links!=null)
						{
							for(Link link:links)
							{
								%>
					<tr  class="mzone">
						<td><strong><a href="<%=link.getEditLink() %>"><%= link.getName() %> </a></strong><div>&nbsp;<span class="Action" style="display:none"><a href="<%=link.getEditLink() %>">Edit </a>| <a href="<%=link.getDeleteLink() %>">Delete</a></span></div></td>
						<td><a href="<%=link.getUrl() %>"><%=link.getUrl() %></a></td>
						<td><%=link.getVisible().toString() %></td>
					</tr>
					
								<%
							}
						}
					%>
				</table>
			</div> 
		</div>
		<jsp:include page="footer.jsp"></jsp:include>
